package com.itheima.health.dao;

import com.github.pagehelper.Page;
import com.itheima.health.pojo.entity.Setmeal;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author zhangmeng
 * @description 套餐DAO
 * @date 2019/9/26
 **/
@Mapper
public interface SetMealDao {
    /**
     * 插入
     * @param setmeal
     */
    void insert(Setmeal setmeal);

    /**
     * 插入与检查组关联关系
     * @param setmealId
     * @param checkgroupId
     */
    void insertSetMealAndCheckGroup(@Param("setmealId") Integer setmealId, @Param("checkgroupId") Integer checkgroupId);

    /**
     * 根据条件分页查询
     * @param queryString
     * @return
     */
    Page<Setmeal> selectByCondition(@Param("queryString") String queryString);

    List<Setmeal> selectAll();

    /**
     * 根据ID查询
     * @param id
     * @return
     */
    Setmeal selectById(@Param("id") Integer id);

    /**
     * 查询所有图片
     * @return
     */
    @Select("select img from t_setmeal")
    List<String> selectImgs();


    @Select("select name from t_setmeal;")
    List<String> selectSetmealName();


     List<Map<String, String>> selectSetmealNameAndCount();

     @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{id}")
    List<Integer> findCheckGroupBySetmealId(Integer id);
}
